package com.first.config.redis;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;

import redis.clients.jedis.JedisPoolConfig;
@Configuration  
@EnableAutoConfiguration  
@ConditionalOnClass(JedisAutoConfig.class)
public class JredisBaseBySpring {
	 private static Logger logger = Logger.getLogger(JredisBaseBySpring.class);  
	 @Autowired 
	 private JedisPoolConfig config;
	      

	 public JedisConnectionFactory getNewConnectionFactory(){  
	        JedisConnectionFactory factory = new JedisConnectionFactory();  
	        factory.setPoolConfig(config);  
	        logger.info("JedisConnectionFactory bean init success."); 
	        return factory;  
	    }  
	    
	    
}
